#ifndef NVIDEODOCKWIDGET_H
#define NVIDEODOCKWIDGET_H
#include <QtWidgets>
#include <QVideoWidget>
#include "tools/Gadget.h"
#include "solar/trunk/NWidget.h"
#include "solar/trunk/NbaseWin.h"
#include "solar/trunk/NinsipidView.h"
#include "solar/trunk/NPlayMask.h"
#include "solar/trunk/NPushButton.h"
#include "solar/trunk/NSurveyor.h"
#include "solar/trunk/NScrollLabel.h"

typedef enum{
    brightness,
    Contrast,
    Hue,
    Saturation
}DurationColor;

class NVideoWidget : public QVideoWidget{

    Q_OBJECT

public:

        NVideoWidget(QWidget *Parent = nullptr);

        ~NVideoWidget();


        void mouseMoveEvent(QMouseEvent *Event);


        void mouseReleaseEvent(QMouseEvent *Event);


        void enterEvent(QEnterEvent *event);


        void leaveEvent(QEvent *Event);


        void wheelEvent(QWheelEvent *Event);


        void mouseDoubleClickEvent(QMouseEvent *Event);


        void keyReleaseEvent(QKeyEvent *Event);

private:
        bool isDoubleFlag;

signals:
        void msev_hver(QString);
        void msev_mv(QString);
        void keyv_pre(QKeyEvent*);
        void msev_rls(QMouseEvent*);
        void msev_db(QMouseEvent*);
        void msev_wheel(bool);
};


class NVideoView : public NMainWindow{

    Q_OBJECT

public:
        NVideoView(QWidget *Parent = nullptr);

        ~NVideoView();

        QWidget *total_temporary = new QWidget;

        QString hint_replace_char = " value";

        QList<QList<QColor>> GradientColor = {{QColor(qRgb(211, 230, 242)), QColor(qRgb(225, 231, 241)), QColor(qRgb(211, 230, 242))},
                                              {QColor(qRgb(211, 230, 242)), QColor(qRgb(225, 231, 241)), QColor(qRgb(232, 248, 243))}};

        QWidget *inner_widget = new QWidget(total_temporary);
        QGridLayout *inner_grid = new QGridLayout(inner_widget);
        NVideoWidget *video_widget = new NVideoWidget(total_temporary);


        QMenu *color_adjustedmenu = new QMenu(inner_widget);
        QAction *coloradjust = new QAction(QIcon(":/PIXMAP/bench/palette.png"), "ColorAdjust", color_adjustedmenu);


        /*------------------------------------Divition for botton - widget*/
        /*botton - widget*/

        Nwidget *bottom_assistwidget = new Nwidget(false,
                                                   3000,
                                                   total_temporary);
        // botton - layout
        QGridLayout *bottom_assistgeid = new QGridLayout(bottom_assistwidget);

        // map-layout

        //预备底部空间，此部分可以添加底部组件，如播放，进度条等
        //botton -basicfuncbut
        NPlayMask *mtpl_mediastat = new NPlayMask(MaskType::PlayButton,
                                                8,
                                                3,
                                                QColor(222,225,232),
                                                QColor(240,243,246),
                                                QColor(236,131,124),
                                                QColor(49,49,49),
                                                bottom_assistwidget);
        NPlayMask *mtpl_medianext = new NPlayMask(MaskType::NextButton,
                                                8,
                                                2,
                                                QColor(236,131,124),
                                                QColor(240,243,246),
                                                bottom_assistwidget);
        NPlayMask *mtpl_medialast = new NPlayMask(MaskType::PriviousButton,
                                                8,
                                                2,
                                                QColor(236,131,124),
                                                QColor(240,243,246),
                                                bottom_assistwidget);

        // playduration
        NSlider *mtpl_durslider = new NSlider(total_temporary, 2, NT::ORIEN_HORIZONTAL);
        // BT_CurrentPlayLabel
        NScrollLabel *mtpl_tracksname = new NScrollLabel(2, total_temporary);
        // BT_StartdratLabel
        NinsipidView *mtpl_begindra = new NinsipidView(total_temporary);
        // BT_EnddratLabel
        NinsipidView *mtpl_finishdra = new NinsipidView(total_temporary);

        QHBoxLayout *MT_centraroof_Hbox = new QHBoxLayout();
        QHBoxLayout *MT_centramax_Hbox = new QHBoxLayout();

        //@Qtimer,定时隐藏底部组件
        QTimer HIDER_BUTTONMD_TIMER;

    void mouseDoubleAssert();


private:
        // Color - module
        Nwidget *color_adjustwidget = new Nwidget(true,
                                                  3000,
                                                  total_temporary);
        QFormLayout *ColorAdjustlayout = new QFormLayout(color_adjustwidget);
        QList<int> FieldLenght;

        NinsipidView *brightness = new NinsipidView(total_temporary);
        NinsipidView *contrast = new NinsipidView(total_temporary);
        NinsipidView *hue = new NinsipidView(total_temporary);
        NinsipidView *saturation = new NinsipidView(total_temporary);

        // basic - slider initialize
        NSlider *brightness_slider = new NSlider(total_temporary, 1);
        NSlider *contrast_slider = new NSlider(total_temporary, 1);
        NSlider *hue_slider = new NSlider(total_temporary, 1);
        NSlider *saturation_slider = new NSlider(total_temporary, 1);


void mouseMoveDispose(QString movename);


void mouseMoveEvent(QMouseEvent*);


void mouseReleaseEvent(QMouseEvent *Event);


void mouseDoubleClickEvent(QMouseEvent *Event);


void keyReleaseEvent(QKeyEvent *Event);


void contextMenuEvent(QContextMenuEvent *Event);


void popuMenuCheck(QAction *Action);


void setColorCondition(DurationColor logo, int Value);


void mouseMoveConsequence();

Extend definfc;

signals:
    void msev_rls();
    void msev_db();
};

#endif // NVIDEODOCKWIDGET_H
